﻿

$(document).ready(function(){

	$("#regButton").attr("disabled","");

	//--- verify username---
	$("#username").change(function(){
		$.ajax({
			url: "inc/dll/ajax.php",
			type: "get",
			data: {
				username:$("#username").val(),
				ajax:true
			},
			beforeSend: function(){
				$("#usernamealert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测中……</font>');
			},
			success: function(html){
				$("#usernamealert").html(html);
			},
			error: function(){
				$("#usernamealert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测超时</font>');
			}
		});
	});



	//--- verify email---
	$("#email").change(function(){
		$.ajax({
			url: "inc/dll/ajax.php",
			type: "get",
			data: {
				email:$("#email").val(),
				ajax:true
			},
			beforeSend: function(){
				$("#emailalert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测中……</font>');
			},
			success: function(html){
				$("#emailalert").html(html);
			},
			error: function(){
				$("#usernamealert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测超时</font>');
			}
		});
	});

	//--- verify password---
	$("#password").change(function(){
		$.ajax({
			url: "inc/dll/ajax.php",
			type: "get",
			data: {
				password:$("#password").val(),
				ajax:true
			},
			beforeSend: function(){
				$("#passwordalert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测中……</font>');
			},
			success: function(html){
				$("#passwordalert").html(html);
			},
			error: function(){
				$("#passwordalert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测超时</font>');
			}
		});
	});


	//--- verify password2---
	$("#password2").change(function(){
		//alert("test");
		$.ajax({
			url: "inc/dll/ajax.php",
			type: "get",
			data: {
				password1:$("#password").val(),
				password2:$("#password2").val(),
				ajax:true
			},
			beforeSend: function(){
				$("#password2alert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测中……</font>');
			},
			success: function(html){
				$("#password2alert").html(html);
			},
			error: function(){
				$("#password2alert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测超时</font>');
			}
		});
	});


	//--- verify password---
	$("#realname").change(function(){
		$.ajax({
			url: "inc/dll/ajax.php",
			type: "get",
			data: {
				realname:$("#realname").val(),
				ajax:true
			},
			beforeSend: function(){
				$("#realnamealert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测中……</font>');
			},
			success: function(html){
				$("#realnamealert").html(html);
			},
			error: function(){
				$("#realnamealert").html('<img src="style/images/loading.gif" align="absbottom" width="18" height="18" /><font color="#006600">检测超时</font>');
			}
		});
	});

});
